<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>
<%@ page import="org.apache.commons.lang.StringUtils,java.util.*,com.hz.framework.util.BusinessException,com.hz.supermanage.bean.*,com.hz.supermanage.dao.Constants,com.hz.framework.util.DateUtil"%>
<jsp:useBean id="dao" class="com.hz.supermanage.dao.OrganizationDao" />
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.hz.framework.dao.CommonDao"%>
<%@ include file="../common/commonLabel.jsp"%>
<%@ include file="../common/commonJS.jsp"%>
<%
    String uuid = request.getParameter("uuid");
	Map emUser = new HashMap();
	String orgname =  "";
    try {
        if (StringUtils.isBlank(uuid)) {
             throw new BusinessException("用户标识不能为空");
        }
        /**
         * 机构是必定会选择了的且不能修改的
         */
        emUser = dao.getPersonSelect(uuid);
        orgname = (String) dao.getOrgNameSelect((String)emUser.get("orgid"));
    } catch (Exception ex) {
        throw new BusinessException("失败", ex);
    }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>修改用户资料</title>
<META http-equiv=Content-Type content=text/html;charset=UTF-8>
<link href="${pageContext.request.contextPath}/parts/CSS/mail.css" rel="stylesheet" type="text/css"/>
<link href="${pageContext.request.contextPath}/parts/CSS/base.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/parts/itemjs/supermanage/setup/Juice.js"></script>
<script src="${pageContext.request.contextPath}/parts/itemjs/supermanage/setup/TreeMouseMenu.js"></script>
<script src="${pageContext.request.contextPath}/parts/itemjs/supermanage/setup/Control.js"></script>
<script src="${pageContext.request.contextPath}/parts/itemjs/supermanage/setup/MessageMgr.js"></script>
<script type="text/javascript">
function touch(u){
	__open(u,"width=650;height=350;center=true;fresh=true");
}
function form1_check($domForm, $errorList) {
	__setServerTime('<%=DateUtil.longtime() %>');

    var mail = __get("email").value;
    if(!isEmail(mail) && !__isEmpty(mail)) {
        $errorList.add("邮件地址不合法，请确认");
    }
    var oldMail = __get("oldEmail").value;
    if(!isEmail(oldMail) && !__isEmpty(oldMail)) {
        if(__getRadioValue("radiobutton")=="edit") {
            $errorList.add("旧邮件地址不合法,请采用\"创建邮件帐户\"创建合法的帐户");
        }
    }
    if(document.all.logincheck.value == "false") {
	    $errorList.add("登录名已被占用，请确认");
	}
}
//岗位调动
function doDiaoDong() {
    __open("pos_move.jsp?uuid=<%=uuid%>", "width=500;height=212;center=true;fresh=true");
}

function onDiaoDongFinish() {
    if (typeof(parent.onDiaoDongFinish) != 'undefined') {
        parent.onDiaoDongFinish();
    }
    __go(document.location.toString());
}

/**检查邮件地址合法性*/
function isEmail($m) {
    var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    if (pattern.test($m)) {
        return true;
    } else {
        return false;
    }
}
function doChecking(obj){
	ajax.checkOneData("hzsyspersonnel","loginid",obj.value,function(back){
		if(back){
			_alert("登录名已被占用");
			document.all.logincheck.value = "false";
			obj.focus();
		}else{
			document.all.logincheck.value = "true";
		}
	});
}
</script>
</head>
	<body style="overflow: hidden;">
		<form name=form1 action="xml/emp_edit_action.jsp" method="post">
			<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: white;" >
				<tr>
					<td height="30" background="${pageContext.request.contextPath}/parts/images/tab_05.gif">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="12" height="30">
									<img src="${pageContext.request.contextPath}/parts/images/tab_03.gif" width="12" height="30" />
								</td>
								<td>
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td width="46%" valign="middle">
												<table width="100%" border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td width="5%">
															<div align="center">
																<img src="${pageContext.request.contextPath}/parts/images/tb.gif" width="16" height="16" />
															</div>
														</td>
														<td width="95%" class="STYLE1">
															用户基本信息：
															<span id='domEmpFilterDesc' style='color: red'></span>
														</td>
													</tr>
												</table>
											</td>
											<td width="54%" align="right">
												<div align="right" style="overflow: auto;">
													<INPUT class="btn2" type="button" value="保  存"
														onclick="__post()" style='cursor: hand'>
													&nbsp;&nbsp;
													<INPUT class="btn2" type="button" value="关闭窗口"
														onclick="parent.__close()" style='cursor: hand'>
													&nbsp;&nbsp;<input type=hidden name="logincheck" value="" />
												</div>
											</td>
										</tr>
									</table>
								</td>
								<td width="16">
									<img
										src="${pageContext.request.contextPath}/parts/images/tab_07.gif"
										width="16" height="30" />
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" height="100%" border="0" cellspacing="0"
							cellpadding="0">
							<tr>
								<!-- 
								<td width="8"
									background="${pageContext.request.contextPath}/parts/images/tab_12.gif">
									&nbsp;
								</td>
								 -->
								<td align="center" valign="top">
									&nbsp;&nbsp;
									<table width=100% class="MFBg">
										<tr>
											<td >

												<table width=100% cellspacing=0 cellspacing=0
													style='table-layout: fixed'>
													<tr>
														<td valign=top align="center" >
															<div style='width: 100%; border: 0px solid #cccccc' >
																<input type=hidden name="personid" value="<%=uuid%>" />
																<table width=95% cellpadding=3 class="MainBody_table">
																<COL ALIGN="right" width="17%">
																<COL ALIGN="left" width="33%">
																<COL ALIGN="right" width="17%">
																	<COL ALIGN="left" width="33%">
																	<tr height="27">
																		<th >
																			姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：
																		</th>
																		<td>
																			<input type=text class="ip_text notnull"
																				name="personname"
																				value="<%=emUser.get("personname")%>"
																				tt.require=true maxlength=50>
																		</td>
																		<th >
																			性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：
																		</th>
																		<td>
																			<select name="sex" tt.selected="<%=emUser.get("sex")%>">
																				<option value="男">男</option>
																				<option value="女">女</option>
																			</select>
																		</td>
																	</tr>
																	<tr height="27">
																		<th >
																			登&nbsp;陆&nbsp;名：
																		</th>
																		<td>
																			<input type=text class='ip_text notnull' tt.require=true name="loginid" value='<%=emUser.get("loginid")%>' onblur="doChecking(this)" maxlength=20>
																		</td>

																		<th >
																			密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：
																		</th>
																		<td>
																			<input type=text class='ip_text notnull'
																				tt.require=true name="password"
																				value='<%=emUser.get("password")%>' maxlength=20>
																		</td>

																	</tr>
																	<tr height="27" >
																		<th >
																			所属单位：
																		</th>
																		<td><%=orgname %>
																			<input type="hidden" name="orgname"
																				value="<%=orgname %>" >
																		</td>
																		<th >
																			所属部门：
																		</th>
																		<td colspan=3>
																			<%=emUser.get("deptid")%>
																		</td>
																	</tr>

																		<tr height="27">
																			<th >
																				隶属岗位：
																			</th>
																			<td><%=emUser.get("posid")%>
																				<a href="javascript:doDiaoDong()"> <img
																						src="${pageContext.request.contextPath}/parts/images/img/diaodong.gif"
																						align=absbottom alt="调动" border=0>调动</a>
																			</td>
																			<th >
																				出生日期：
																			</th>
																			<td>
																				<input type=text class='ip_text Wdate'
																					name="birthday"
																					value="<%=emUser.get("birthday")==null?"":emUser.get("birthday")%>"
																					onfocus="WdatePicker({dateFmt:'yyyy年MM月dd日',readOnly:true})">
																			</td>
																		</tr>
																		<!--
			<tr >
			<th>民&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;族：</th><td><input type=text class=ip_text name="folk" value="<%=emUser.get("folk")%>" maxlength=50></td>
			<th>籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯：</th><td><input type=text class=ip_text name="hometown" value="<%=emUser.get("hometown")%>" maxlength=50></td>
			</tr>
			-->


																		<!--
            <tr>
			<th>最高学历：</th><td><input type=text class=ip_text name="mastdegree" value="<%=emUser.get("mastdegree")%>" maxlength=50></td>
			<th>其他证书：</th><td><input type=text class=ip_text name="certificate" value="<%=emUser.get("certificate")%>" maxlength=50></td>
			</tr>
			
			<tr>
			<th>身份证号：</th><td><input type=text class=ip_text name="idcard" value="<%=emUser.get("idcard")%>" maxlength=50 tt.checktype=IDCard ></td>
			<th>健康情况：</th><td><input type=text class=ip_text name="health" value="<%=emUser.get("health")%>" maxlength=50></td>
			</tr>
			-->
																		<tr height="27">
																			<th >
																				手机号码：
																			</th>
																			<td>
																				<input type=text class='ip_text notnull'
																					tt.require=true name="mobiletelephone"
																					value="<%=emUser.get("mobiletelephone")==null?"":emUser.get("mobiletelephone")%>"
																					maxlength=13>
																			</td>
																			<th >
																				政治面貌：
																			</th>
																			<td>
																				<input type=text class=ip_text name="genro"
																					value="<%=emUser.get("genro")==null?"":emUser.get("genro")%>"
																					maxlength=50>
																			</td>
																		</tr>

																		<tr height="27">
																			<th >
																				婚姻情况：
																			</th>
																			<td>
																				<select name="marriage" tt.selected="<%=emUser.get("marriage")%>">
																					<option value="未婚">未婚</option>
																					<option value="已婚">已婚</option>
																					<option value="离异">离异</option>
																				</select>
																				<%--<input type=text class=ip_text name="marriage"
																					value="<%=emUser.get("marriage")==null?"":emUser.get("marriage")%>"
																					maxlength=50>
																			--%></td>
																			<th >
																				联系电话：
																			</th>
																			<td>
																				<input type=text class=ip_text name="telephone"
																					value="<%=emUser.get("telephone")==null?"":emUser.get("telephone")%>"
																					maxlength=50 tt.checktype=phone>
																			</td>
																		</tr>
																		<tr>
																			<th >
																				电子邮件：
																			</th>
																			<td colspan=3>
																				<input type=text class=ip_text name="email"
																					value="<%=emUser.get("email")==null?"":emUser.get("email")%>"
																					maxlength=50>
																				<input type=hidden name="oldEmail"
																					value="<%=emUser.get("email")%>">
																			</td>
																		</tr>
																		<tr height="23">
																			<th>
																				固定IP：
																			</th>
																			<td colspan=3>
																				<input type=text class='ip_text' name="gid"
																					value="<%=emUser.get("gid")==null?"":emUser.get("gid")%>" maxlength=50>
																			</td>
																		</tr>
																		<tr height="27">
																			<th >
																				地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：
																			</th>
																			<td colspan=3>
																				<input type=text class=ip_text name="address"
																					value="<%=emUser.get("address")==null?"":emUser.get("address")%>"
																					style='width: 99%' maxlength=200>
																			</td>
																		</tr>

																		<tr height="46">
																			<th >
																				备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：
																			</th>
																			<td colspan=3>
																				<textarea class=ip_textarea name="remark"
																					style='height: 40px' maxlength=150><%=emUser.get("remark")==null?"":emUser.get("remark")%></textarea>
																			</td>
																		</tr>
																</table>
															</div>
														</td>
														<td width=300 valign=top>
<script type="text/javascript">
function doCreatePosOperation($type, $posId) {
    if ($type == "<%=Constants.EMP_POS_MASTER%>") {
        return "<a href=javascript:doDiaoDong()>调动</a>";
    } else {
        return "<a href=javascript:doCheZhi('" + $posId + "')>撤职</a>";
    }
}
//安排职位
function doAddPos() {
    __open("emp_pos_add.jsp?empId=<%=uuid%>", "width=500;height=160;center=true;fresh=true");
}

//PosLister
function onRenZhiFinish() {
    __get("PosLister").reload();
}

//撤职
function doCheZhi($posId) {
    if (!confirm("你确认要撤除用户该岗位吗？")) {
        return;
    }
    _Xuice.url("xml/emp_pos_del_action.jsp?perId=<%=uuid%>&posId=" + $posId, finish, false);
    function finish($doc) {
        __alert("撤职成功！");
        __get("PosLister").reload();
    }
}
</script>
			<table width=100% style='background-color: #CFEBA5'>
				<tr>
					<td>
						<img
							src="${pageContext.request.contextPath}/parts/images/img/pos.gif"
							align=absbottom>
						任职情况
					</td>
					<td align=right style='padding: 2px'>
						<INPUT class="btn2" type="button" value="安排职位"
							onclick="doAddPos()" style='cursor: hand'>
					</td>
				</tr>
			</table>
			<table id=COMP tt.impl="TableLister" name=PosLister
				width=100% tt.data.url="xml/pos_xml.jsp?empId=<%=uuid%>"
				tt.instance="PosLister" bordercolor=#B5D6E6 border=1
				style='border-collapse: collapse;' cellspacing=0
				cellpadding=3 class="data_list_table" >
				<xml>
				<view>
				<![CDATA[
                <tr style='cursor:default' align=center>
                    <td align=center>#depname#&nbsp;</td>
                    <td>#posname#&nbsp;</td>
                    <td>#ptypevalue#&nbsp;</td>
                    <td>
                        [SCRIPT]doCreatePosOperation('#ptype#','#posid#')[/SCRIPT]
                    </td>
                </tr>
                ]]>
										</view>
										</xml>
										<COL ALIGN=LEFT width="35%">
										<COL ALIGN=CENTER width="35%">
										<COL ALIGN=CENTER width="15%">
										<COL ALIGN=CENTER width="15%">
										<thead>
											<tr class=data_list_thead>
												<td align=center>
													部门
												</td>
												<td align=center>
													岗位
												</td>
												<td align=center>
													类型
												</td>
												<td align=center>
													操作
												</td>
											</tr>
										</thead>
										<tbody class=data_list_body>
										</tbody>
									</table>
								</td>
							</tr>
						</table>
						<!-- end frame table -->
					</td>
				</tr>
				
			</table>
		</td>
	</tr>
	<tr>
		<td height="35" background="${pageContext.request.contextPath}/parts/images/tab_19.gif">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="12" height="35">
						<img src="${pageContext.request.contextPath}/parts/images/tab_18.gif" width="12" height="35" />
					</td>
					<td>&nbsp;</td>
					<td width="16">
						<img src="${pageContext.request.contextPath}/parts/images/tab_20.gif" width="16" height="35" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
	</body>
</html>